Skip to content

Add auto-generated template schema documentation#1166

Open
nrichers wants to merge 1 commit intomainfrom
sc-6164/template-schema-docs
Open

Add auto-generated template schema documentation#1166
nrichers wants to merge 1 commit intomainfrom
sc-6164/template-schema-docs

Conversation

@nrichers
Copy link
Collaborator

@nrichers nrichers commented Feb 10, 2026

Summary

  • Create scripts/generate_template_schema_docs.py to generate HTML schema documentation from the backend JSON Schema using json-schema-for-humans
  • Update customize-document-templates.qmd to include the generated HTML instead of hardcoded content
  • Add "Generated documentation" section to README.md with instructions for both permissions and template schema scripts

Context

The template schema documentation in customize-document-templates.qmd was outdated (last generated June 2023) and hardcoded. This PR introduces a script-based approach similar to the permissions documentation, ensuring the schema reference stays in sync with the backend source.

The script:

  • Reads from backend/src/backend/templates/documentation/model_documentation/mdd_template_schema_v5.json
  • Generates HTML using json-schema-for-humans with CSS overrides for Quarto compatibility
  • Outputs to site/guide/templates/_template-schema-generated.html

Test plan

  • Verify python scripts/generate_template_schema_docs.py runs without errors
  • Preview the docs site and check the template schema section renders correctly
  • Verify the generated HTML includes ValidMind branding colors

Closes sc-6164

- Create generate_template_schema_docs.py script to generate HTML schema
  docs from backend JSON Schema using json-schema-for-humans
- Update customize-document-templates.qmd to use generated include
- Add template schema and permissions documentation sections to README.md

The template schema is now regenerated from the v5 JSON schema in the
backend repo, replacing the outdated hardcoded HTML.

Closes sc-6164
@nrichers nrichers force-pushed the sc-6164/template-schema-docs branch from bc9038a to a75688a Compare February 10, 2026 21:01
@github-actions
Copy link
Contributor

Pull requests must include at least one of the required labels: internal, highlight, enhancement, bug, deprecation, documentation. Except for internal, pull requests must also include a description in the release notes section.

1 similar comment
@github-actions
Copy link
Contributor

Pull requests must include at least one of the required labels: internal, highlight, enhancement, bug, deprecation, documentation. Except for internal, pull requests must also include a description in the release notes section.

@github-actions
Copy link
Contributor

PR Summary

This PR improves the documentation workflow for the template schema by introducing two major enhancements:

  1. A dedicated documentation section has been added to the README that provides instructions on regenerating the auto-generated documentation. It explains how to run the scripts (such as generate_permissions_docs.py and generate_template_schema_docs.py) along with their dependencies (e.g. Python 3.9+ and required packages). This aims to keep the documentation in sync with backend changes.

  2. A new Python script (scripts/generate_template_schema_docs.py) has been introduced. This script leverages the json-schema-for-humans package to generate HTML documentation from the backend JSON Schema. It also performs post-processing on the generated HTML by:

    • Injecting custom CSS overrides for Quarto compatibility
    • Prepending a copyright header
    • Replacing parts of the theme to include a Quarto stylesheet
    • Cleaning up temporary files after generating the final output file

Additionally, the template documentation file (site/guide/templates/customize-document-templates.qmd) has been updated to reference the auto-generated HTML file instead of embedding a large chunk of static HTML inline. This separation helps with maintainability and ensures that changes to the backend schema are automatically reflected in the documentation.

Overall, the changes streamline the process of updating documentation by automating the extraction and formatting of backend JSON Schemas into readable site documentation.

Test Suggestions

  • Run the 'generate_template_schema_docs.py' script in an environment where the backend repo is cloned at the expected relative path (../backend) and verify that the output file is correctly generated under 'site/guide/templates/_template-schema-generated.html'.
  • Modify the backend JSON Schema (e.g. mdd_template_schema_v5.json) and re-run the script to ensure that changes are accurately propagated to the generated documentation.
  • Test the inclusion of the generated schema file in 'customize-document-templates.qmd' to verify that the documentation renders correctly on the site.
  • Simulate missing dependencies (e.g., uninstall 'json-schema-for-humans') to ensure that the script fails gracefully with an appropriate error message.

@nrichers nrichers added documentation Improvements or additions to documentation internal Not to be externalized in the release notes labels Feb 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation internal Not to be externalized in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant